﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace T12OOP
{
    /// <summary>
    /// 单例模式类
    /// </summary>
    class SingleTon
    {
        private static SingleTon _instance;

        private SingleTon()
        {
            Console.WriteLine("创建单例对象");
        }

        public static SingleTon GetInstance()
        {
            if (_instance == null)
            {
                _instance = new SingleTon();
            }

            return _instance;

        }
    }
}